#include <PlayerCommands.h>
#include <PlayerInterface.h>

namespace ControlSets
{
std::map<unsigned char, void (*)(PlayerInterface&)> default_controls;
std::map<unsigned char, void (*)(PlayerInterface&)> default_walk_controls;
std::map<unsigned char, void (*)(PlayerInterface&)> current_controls; 
std::map<unsigned char, void (*)(PlayerInterface&)> menu_controls;
}

typedef unsigned char keytype;

namespace Default
{
	const keytype FORWARD = 'w';
	const keytype SLOW = 's';
	const keytype BACKWARD = 's';
	const keytype TURNLEFT = 'a';
	const keytype TURNRIGHT = 'd';
}

namespace PlayerCommands
{
	//All commands take a reference to the player interface called 'pi'


	Command( MoveForward )
	{
		pi.MoveForward();
	}
	
	Command( TurnLeft )
	{
		pi.TurnLeft();
	}
	
	Command( TurnRight )
	{
		pi.TurnRight();
	}
	
	Command( SlowDown )
	{
		pi.Slow();
	}


	Command( Walk_MoveForward )
	{
		pi.Walk_MoveForward();
	}
	
	Command( Walk_MoveBackward )
	{
		pi.Walk_MoveBackward();
	}
	
	Command( Walk_TurnLeft )
	{
		pi.Walk_TurnLeft();
	}
	
	Command( Walk_TurnRight )
	{
		pi.Walk_TurnRight();
	}


}

namespace RunOnce
{
	void GenerateControlSets()
	{
		MapKey( default_controls, Default::FORWARD, MoveForward )
		MapKey( default_controls, Default::TURNLEFT, TurnLeft )
		MapKey( default_controls, Default::TURNRIGHT, TurnRight )
		MapKey( default_controls, Default::SLOW, SlowDown )
		
		MapKey( default_walk_controls, Default::FORWARD, Walk_MoveForward )
		MapKey( default_walk_controls, Default::TURNLEFT, Walk_TurnLeft )
		MapKey( default_walk_controls, Default::TURNRIGHT, Walk_TurnRight )
		MapKey( default_walk_controls, Default::BACKWARD, Walk_MoveBackward )
	}
}
